package ProyectoX;

import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Image;
import javax.swing.JPanel;

/**
 * Clase publica ImagePanel extiende a JPanel.
 */
public class ImagePanel extends JPanel {
	
	private Image img;
	
	/**
	 * Constructor. Inicializa los atributos.
	 */
	public ImagePanel(Image img){
		this.img = img;
		Dimension dimension = new Dimension(img.getWidth(null),img.getHeight(null));
		this.setPreferredSize(dimension);
		this.setMaximumSize(dimension);
		this.setMaximumSize(dimension);
		this.setSize(dimension);
		this.setLayout(null);
		
	}

	/**
	 *Inserta la imagen al objeto.
	 */
	protected void paintComponent(Graphics g){
		g.drawImage(img,0,0,null);
	}
	
}